import { Injectable } from '@angular/core';
export const GlobalVariable = freezeObject({

  BASE_API_URL: 'http://101.37.24.73/',

  //... more of your variables
  app : {
    name: 'United工业物联平台',
    version: '1.0',
    // for chart colors
    color: {
      primary: '#7266ba',
      info: '#23b7e5',
      success: '#27c24c',
      warning: '#fad733',
      danger: '#f05050',
      light: '#e8eff0',
      dark: '#3a3f51',
      black: '#1c2b36'
    },
    settings: {
      themeID: 1,
      navbarHeaderColor: 'bg-black',
      navbarCollapseColor: 'bg-white-only',
      asideColor: 'bg-black',
      headerFixed: true,
      asideFixed: false,
      asideFolded: false
    }
  },
  menu:{
    path:'page',
    children:[
      //{
      //  path:'dashboard',
      //  title:'概览',
      //  trans:'DASHBOARD',
      //  cls:'fa fa-dashboard',
      //  active:false,
      //  index:true,
      //  order:0
      //
      //},
      {
        path:'monitor',
        title:'设备监控',
        trans:'MONITOR',
        cls:'glyphicon glyphicon-eye-open',
        active:false,
        index:false,
        order:100,
        children:[
          {
            path:'monitorcenter',
            title:'监控中心',
            trans:'MONITOR_CENTER',
            order:0
          },
          {
            path:'single/none',
            title:'单机监控',
            trans:'SINGLE_MONITOR',
            order:1
          },
          {
            path:'gis',
            title:'GIS监控',
            trans:'GIS_MONITOR',
            order:2
          },
          {
            path:'group',
            title:'群组监控',
            trans:'GROUP_MONITOR',
            order:3
          },
          {
            path:'customize',
            title:'自定义监控',
            trans:'CUSTOM_MONITOR',
            order:4
          }
        ]
      },
      {
        path:'repair',
        title:'设备急修',
        trans:'ALARM',
        cls:'glyphicon glyphicon-wrench',
        active:false,
        index:false,
        order:100,
        children:[
          {
            path:'order',
            title:'维修工单',
            trans:'MAINTENANCE_ORDER',
            order:0
          },
          {
            path:'record',
            title:'维修记录',
            trans:'REPAIR_ORDER',
            order:1
          }
        ]
      },
      {
        path:'archives',
        title:'设备档案',
        trans:'EQUIPMENT_FILES',
        cls:'glyphicon glyphicon-edit',
        active:false,
        index:false,
        order:300,
        children:[
          {
            path:'info',
            title:'设备信息',
            trans:'EQUIPMENT_INFOR',
            order:0
          },
          {
            path:'weibao',
            title:'维保工单',
            trans:'MAINTENANCE_ORDER',
            order:1
          }
        ]
      },
      {
        path:'statistics',
        title:'数据统计',
        trans:'STATISTICS',
        cls:'glyphicon glyphicon-stats',
        active:false,
        index:false,
        order:500,
        children:[
          {
            path:'fault',
            title:'故障统计',
            trans:'BREAKDOMN',
            order:0
          },
          {
            path:'run',
            title:'运行统计',
            trans:'OPERATION',
            order:1
          }
        ]
      },
      {
        path:'inform',
        title:'消息通知',
        trans:'MESSAGES',
        cls:'glyphicon glyphicon-envelope icon text-info-lter',
        active:false,
        index:false,
        order:500,
        children:[
          {
            path:'sysinform',
            title:'系统通知',
            trans:'SYSTEM_NOTI',
            order:0
          },
          {
            path:'userinform',
            title:'用户通知',
            trans:'USER_NOTI',
            order:1
          }
        ]
      },
      {
        path:'accountinfo',
        title:'用户信息',
        trans:'USER_INFO',
        cls:'glyphicon glyphicon-calendar icon text-info-dker',
        active:false,
        index:false,
        order:500,
        children:[
          {
            path:'userinfo',
            title:'基本信息',
            trans:'ESSENTIAL_INFO',
            order:0
          },
          {
            path:'modifypassword',
            title:'密码修改',
            trans:'PASSWORD_MODIF',
            order:1
          }
        ]
      },
      {
        path:'sys',
        title:'系统管理',
        trans:'SYS_MANGEMENT',
        cls:'glyphicon glyphicon-cog',
        active:false,
        index:false,
        order:600,
        children:[
          {
            path:'competence',
            title:'权限管理',
            trans:'AUTHORITY_MANAGEMENT',
            order:0
          },
          {
            path:'role',
            title:'角色管理',
            trans:'ROLES_MANAGEMENT',
            order:1
          },
          {
            path:'account',
            title:'用户管理',
            trans:'USERS_MANAGEMENT',
            order:2
          },
          {
            path:'company',
            title:'公司管理',
            trans:'COMPANY_MANAGEMENT',
            order:3
          },
          {
            path:'product',
            title:'设备管理',
            trans:'DEVICES_MANAGEMENT',
            order:4
          },
          {
            path:'groups',
            title:'群组管理',
            trans:'GROUP_MANAGEMENT',
            order:5
          }
        ]
      }
    ],
    head: {
      dashboard: '概览',
      monitor:'设备监控',
      monitorcenter:'监控中心',
      single:'单机监控',
      gis:'GIS监控',
      group:'群组监控',
      customize:'自定义监控',
      repair:'设备急修',
      order:'维修工单',
      record:'维修记录',
      archives:'设备档案',
      info:'设备信息',
      weibao:'维保工单',
      statistics:'数据统计',
      fault:'故障统计',
      run:'运行统计',
      inform:'消息通知',
      sysinform:'系统通知',
      userinform:'用户通知',
      sys:'系统管理',
      competence:'权限管理',
      role:'角色管理',
      account:'用户管理',
      company:'公司管理',
      product:'设备管理',
      groups:'群组管理'
    }
  },
  tooltip:{
    editcompanyTooltip : '编辑公司',
    delcompanyTooltip : '删除公司',
    editaccountTooltip : '编辑账户',
    delaccountTooltip : '删除账户',
    editprotyTooltip : '编辑产品类型',
    delprotyTooltip : '删除产品类型',
    proattrlistTooltip : '属性列表',
    delproattrTooltip : '删除产品属性',
    editproattrTooltip : '编辑产品属性',
    devlistTooltip : '设备列表',
    delproTooltip : '删除产品',
    editproTooltip : '编辑产品',
    prodatapointTooltip: '产品数据点',
    editproductTooltip : '编辑设备',
    delproductTooltip : '删除设备',
    editauthTooltip : '关联权限',
    checkauthTooltip : '查看权限',
    editroleTooltip : '角色修改',
    delroleTooltip : '删除角色',
    assignrolesTooltip : '分配角色',
    assignproductTooltip : '分配产品',
    orderoperate1Tooltip : '报警',
    orderoperate2Tooltip : '接警',
    orderoperate3Tooltip : '到场',
    orderoperate4Tooltip : '完工',
    orderoperate5Tooltip : '恢复',
    editgroupTooltip : '编辑群组',
    deletegroupTooltip : '删除群组',
    deviceinfoTooltip : '完善设备信息',
    jiejingTooltip : '接警',
    yijiejingTooltip : '已接警',
    yijiejing1Tooltip : '未接警',
    wangongTooltip : '完工',
    querenTooltip : '客户确认',
    daochangTooltip : '已到场',
    daochang1Tooltip : '不需要到场',
    daochang2Tooltip : '未到场',
    yiquerenTooltip : '已确认',
    yiqueren1Tooltip : '未确认',
    bianjigongdanTooltip : '工单编辑',
    shanchugongdanTooltip : '工单删除',
    chexiaogongdanTooltip : '撤销工单',
    chuliweibaoTooltip : '确认',
    chexiaoweibaoTooltip : '撤销',
    shanchuweibaoTooltip : '删除',
    yichuliweibaoTooltip : '已确认',
    yichuliweibao1Tooltip : '未确认',
    huifuweibao1Tooltip : '未恢复',
    huifuweibaoTooltip : '恢复'
  }
});

//递归冻结对象 [对象和数组都属于'object']
function freezeObject(Obj){
  for(let index in Obj){
    //判断属性是否私有、是否对象或数组、是否已冻结
    if(!Obj.hasOwnProperty(index) || !(typeof Obj[index] === "object") || Object.isFrozen(Obj[index])){
      continue;
    }
    freezeObject(Obj[index]);
  }
  return Object.freeze(Obj);
}
